package orm

import (
	"gluenet/pkg/ops/dbi"
)

const deleteConfig = "delete from config where label = ?"

func ConfigDelete(c dbi.GlueDB, key string) error {
	if _, err := c.MetaDB().Exec(deleteConfig, key); err != nil {
		return err
	}
	return nil
}

const deleteInstance = "delete from instance where guid = ?"

func InstanceDelete(c dbi.GlueDB, guid string) error {
	if _, err := c.MetaDB().Exec(deleteInstance, guid); err != nil {
		return err
	}
	return nil
}

const deleteScheduleResult = "delete from schedule_result where instances_guid = ?"

func DeleteScheduleResult(c dbi.GlueDB, guid string) error {

	if _, err := c.MetaDB().Exec(deleteScheduleResult, guid); err != nil {
		return err
	}
	return nil
}
